package cn.com.sinosoft.exam.comm;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 
 * Swagger配置
 * @author 刘韵琴
 *
 */
@Configuration
@EnableSwagger2
public class Swagger2Configuration {

	/**
	 * 返回一个实例对象
	 */
	@Bean
	public Docket platformApi() {
		return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
				.select().apis(RequestHandlerSelectors.basePackage("cn.com.sinosoft"))
				.paths(PathSelectors.any()).build();
	}

	private ApiInfo apiInfo() {
		return new ApiInfoBuilder().title("SinoSoft-API")
			.description("Powered By sinosoft Co.,Ltd.")
			.license("Apache License Version 2.0")
			.licenseUrl("https://github.com/springfox/springfox/blob/master/LICENSE")
			.version("2.0").build();
	}
}